-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: High-rate IMU sampling #8731
Conversation
#define accel_report sensor_accel_s | ||
#define accel_unfiltered_report sensor_accel_unfiltered_s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can stop doing this now.
unsigned _gyro_control_interval; | ||
unsigned _gyro_count; | ||
bool _gyro_publish_unfiltered; | ||
perf_counter_t _sample_interval_accel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider consolidating these and dropping as many as possible. If you profile a nuttx board you'll find they definitely aren't free.
Awesome! I didn't know you wanted to push this through, but we might as well do it now. I was thinking of SPI DMA and doing the work in a high priority thread per bus. It also might make sense to split it up a bit. There's a larger driver architecture discussion we need to have, but let me see if I can make some progress on SPI DMA drivers this weekend. |
Questions
|
mpu9250: don't set DLPF when updating sensor poll rate
f53f3b5
to
26a67e2
Compare
Rebased on master and added a trivial formatting fix. |
If we only run the attitude control portion with attitude updates (8ca0302), the mc_att_control cpu usage is 17% at 2kHz and ~8-9% at 1kHz. What's interesting though is that the actual work of the rate controller (copy gyro data, PID, publish) is incredibly small (~ 20us). It's something else in the system (uORB, poll, etc) that's killing us.
mpu600 perf
|
@dagar I see you already added the mc att control update too, cool :). Yeah the load must be somewhere else, I was pretty surprised when I saw 22% for not doing so much..
It would definitely need some more magic to do this. Currently, for logging 2 IMUs at 2kHz I needed the logger to run at 4kHz, and even with a larger buffer I see periodic drops at the write operation (I think). I'm using the fastest possible SD cards and only logging the IMU data. The logger uses ~20% CPU in that case. At least for VTOL I don't see this happening at the moment with a v2/v3. But as we see there is a lot of cpu power vanishing, so lets have a look how this develops. |
Closing this PR, but keeping the branch for now. |
Continuing #7446. @dagar @priseborough @jgoppert . I needed a better idea about vibration in a system and this is a good start. This is also one step towards #7446 (comment)
This still suffers from missing DMA/FIFO access. But I was able to log unfiltered data from 2 IMUs at 2kHz, which is already pretty nice. And you can publish gyro control messages at 2kHz as well, but in that case the MC attitude controller uses 22% CPU ;)
This is NOT test flown, I'm really just bench testing at the moment.
Tasks / open questions
Is that going into the right direction?
@dagar you mentioned you could help with DMA?